home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 April
/
EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso
/
EARCD
/
comm
/
thor
/
thor24arexx.lha
/
FSE
/
FindFile.fse
< prev
next >
Wrap
Text File
|
1996-11-11
|
3KB
|
136 lines
/* FindFiles.fse by Troels Walsted Hansen
** With searchcode by Eivind Nordseth
** $VER: FindFiles.fse v1.11 (21.11.94)
**
** An ARexx script that finds files matching a search pattern on
** a chosen bbs and inserts the file information into the FSE
** you are currently using.
*/
options results
/* needs FSE, THOR and bbsread.library functions */
if(substr(address(),1,8) ~= "THOR_FSE") then
do
say "This script should only be started from inside the FSE."
exit 20
end
else fseport = address()
p = ' ' || address() || ' ' || show('P',,)
thorport = pos(' THOR.',p)
if thorport > 0 then thorport = word(substr(p,thorport+1),1)
else
do
say 'No THOR port found!'
exit 10
end
if ~show('p', 'BBSREAD') then
do
address command
"run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
"WaitForPort BBSREAD"
end
/* get bbsname */
address (bbsread)
GETBBSLIST stem BBSLIST
if(rc ~= 0) then
do
address(thorport)
REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
exit 5
end
address(thorport)
THORTOFRONT
REQUESTLIST instem BBSLIST title '"Select BBS:"' SIZEGADGET
if(rc ~= 0) then exit
else bbs = result
/* get searchpattern */
REQUESTSTRING TITLE '"Please enter search pattern:"' BT '"_Ok|_Cancel"' MAXCHARS 100
pattern = result
if(rc ~= 0 | pattern = "") then exit
address (bbsread)
SEARCHBRFILE bbsname '"' || bbs || '"' stem SRESULT search '"' || pattern || '"' keyword
if(result > 0) then
do
do f=1 to SRESULT.FILEAREA.COUNT
address(fseport)
INSERTSTRING '0a'x || '(' || SRESULT.FILEAREA.f || ')' || '0a'x
do i=1 to SRESULT.FILE.f.COUNT
call showfiledata('"' || bbs || '"', '"'|| SRESULT.FILEAREA.f || '"', SRESULT.FILE.f.i, fseport)
end
end
end
else
do
address(fseport)
INSERTSTRING 'No files found.' || '0a'x
end
exit
/* Procedure to show the data about a file */
showfiledata: procedure
parse arg bbs,farea,filenr,fseport
FDF_DELETED = '00000001'x
drop FILE. /* Important */
address (bbsread)
READBRFILE bbs farea filenr tagsstem FILE datastem DATA
nextfile = result
if (bitand(DATA.FLAGS,FDF_DELETED) ~= FDF_DELETED) then
do
if(symbol("FILE.DATE") = "VAR") then fdate = FILE.DATE
else date = DATA.FILEDATE
AMIGA2DATE fdate CD
fdatestr = right(CD.YEAR, 2) || right('0'||CD.MONTH, 2) || right('0'||CD.MDAY, 2)
if(symbol("FILE.SIZE") = "VAR") then fsize = FILE.SIZE
else size = "Unkn"
if(symbol("FILE.DOWNLOADS") = "VAR") then fdnls = FILE.DOWNLOADS
else fdnls = "Unkn"
if(symbol("FILE.DESCRIPTION.COUNT") = "VAR") then descr = FILE.DESCRIPTION.1
else descr = "NONE"
address(fseport)
INSERTSTRING left(FILE.NAME,16) || " " || fdatestr || " " || right(fsize,7) || right(fdnls,4) || " " || descr || '0a'x
if(descr ~= "NONE") then
do
if(FILE.DESCRIPTION.COUNT > 1) then
do
do n=2 to FILE.DESCRIPTION.COUNT
address(fseport)
INSERTSTRING left("",33) || FILE.DESCRIPTION.n || '0a'x
end
end
end
end
else
do
address(fseport)
INSERTSTRING 'File is deleted.' || '0a'x
end
return nextfile